package com.yahoo.labs.snow.util;

import it.unimi.dsi.fastutil.io.FastBufferedOutputStream;
import it.unimi.dsi.io.FileLinesCollection;
import it.unimi.dsi.io.FileLinesCollection.FileLinesIterator;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintWriter;
import java.nio.charset.Charset;

public class FileUtils {

	public static FileLinesIterator getIterator(File file) {
		FileLinesCollection flc = new FileLinesCollection((CharSequence) file.getAbsolutePath(), Charset.forName("UTF-8").name(), false);
		return flc.iterator();
	}
	
	public static PrintWriter getWriter(File file) throws FileNotFoundException {
		return new PrintWriter( new FastBufferedOutputStream(new FileOutputStream(file)));
	}

}
